package controllers

import (
	"lottery_code/comm"
)

func (c *IndexController) GetLucky() map[string]interface{} {
	rs := make(map[string]interface{})
	rs["code"] = 0
	rs["msg"] = ""
	//1.验证登录用户
	loginUser := comm.GetLoginUser(c.Ctx.Request())
	if loginUser == nil {
		rs["code"] = 101
		rs["msg"] = "请登录后再来抽奖吧"
		return rs
	}
	ip:=comm.ClientIp(c.Ctx.Request())
	api:=&LuckyApi{}
	code,msg,prizeList:=api.luckyDo(loginUser.Uid,loginUser.Username,ip)
	rs["code"] = code
	rs["msg"] = msg
	rs["gift"]=prizeList
	return rs
}
